﻿using System;
using System.Diagnostics;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace WinForm.Common
{
    public class ObjectHelper
    {
        public static void ShowWebSite(string url)
        {
            if (url == null) return;
            string processName = url.Replace(" ", string.Empty);
            if (processName.Length == 0) return;
            const string protocol = "http://";
            const string protocol2 = "https://";
            if (processName.IndexOf(protocol, StringComparison.Ordinal) != 0 && processName.IndexOf(protocol2, StringComparison.Ordinal) != 0)
                processName = protocol + processName;
            StartProcess(processName);
        }
        public static void StartProcess(string processName)
        {
            try
            {
                Process.Start(processName);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, ResourcesHelper.GetString("Error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}
